import java.util.*;
/**
 * @Author: YCKOKO
 * @Date: 2023-05-12
 * @Time:10:15
 * @Description:
 */
public class demo1 {

    Collection
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.nextLine();
        String[] nums = s.split(" ");
        int a = Integer.parseInt(nums[0]);
        int b = Integer.parseInt(nums[1]);
        String ret = Integer.toString(a,b);
        ret = ret.toUpperCase();
        System.out.println(ret);
    }
}
